{extend name="layout/layout" /}
<!--请在下方写此页面body相关内容-->
{block name="container"}
<article class="page-container">
    <form  method="post" class="form form-horizontal" id="form-change-password">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">账户：</label>
            <div class="formControls col-xs-9 col-sm-9"> <?php echo $info['username']?> </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>原密码：</label>
            <div class="formControls col-xs-9 col-sm-9">
                <input type="password" class="input-text" autocomplete="off"  name="oldpassword" id="oldpassword">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>新密码：</label>
            <div class="formControls col-xs-9 col-sm-9">
                <input type="password" class="input-text" autocomplete="off"  name="password" id="password">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>确认密码：</label>
            <div class="formControls col-xs-9 col-sm-9">
                <input type="password" class="input-text" autocomplete="off"  name="repassword" id="repassword">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-3 col-sm-offset-3">
                <input type="hidden" value="<?php echo $info['id']?>" name="id">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
{/block}
<!--请在上方方写此页面body相关内容-->

<!--请在下方写此页面业务相关的脚本-->
{block name="js"}
<script type="text/javascript">
$(function(){
    $("#form-change-password").validate({
        rules:{
            oldpassword:{required:true, minlength:6, maxlength:18},
            password:{required:true, minlength:6, maxlength:18},
            repassword:{required:true, minlength:6, maxlength:18, equalTo: "#password"},
        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            var options = {
                beforeSubmit: function () {
                    load = layer.load();
                },
                success: function(obj){
                    if(obj.code !== 0){
                        layer.msg(obj.msg,{ icon:5, time:2000 });
                    } else {
                        layer.msg(obj.msg, { icon: 1, time: 1000 }, function(){
                            closeWindow();
                        });
                    }
                    layer.close(load);
                }
            };
            $(form).ajaxSubmit(options);
        }
    });
});
</script>
{/block}
<!--/请在上方写此页面业务相关的脚本-->